/**
 * 
 */
package org.bankabeule.ui.utils;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;

/**
 * @author sdudoit
 *
 */
public class UIUtils {

	
	/**
	 * Constructor
	 */
	private UIUtils() {
	}
	
	
	/**
	 * Center shell form parent with given size
	 */
	public static void center(Shell newShell, Shell parentShell, int width, int height) {
		newShell.setSize(width, height);
		Point parentPoint = parentShell.getSize();
		Point newPoint = new Point(parentPoint.x, parentPoint.y);
		newPoint.x = parentShell.getLocation().x + (parentPoint.x - 400) / 2;
		newPoint.y = parentShell.getLocation().y + (parentPoint.y - 500) / 2;
		newShell.setLocation(newPoint);
	}
	
	
}
